package com.li.suanfa;

import java.util.Arrays;

/**  
* 类说明   
*  
* @author ****  
* @date 2018年4月1日  新建  
*/
public class SLType2 {
	int len;
	Node head;
	Node tail;
	
	static class Node{
		Data data;
		Node next;
		public Node(Data data) {
			this.data = data;
		}
		
		public Node(){
			
		}

		@Override
		public String toString() {
			return "Node [data=" + data + "]";
		}
		
	}
	static class Data{
		String key;
		String value;
		Data(String key,String value){
			this.key = key;
			this.value = value;
		}
		@Override
		public String toString() {
			return "Data [key=" + key + ", value=" + value + "]";
		}
	}
	
	public void addNode(Data data){
		Node node  = new Node(data);
		if(head == null){
			head = new Node();
			tail = head;
		}
		tail.next = node;
		tail = node;
		len++;
	}
	
	public void print(){
		Node node = head.next;
		while(node!=null){
			System.out.println(node.data.value);
			node = node.next;
		}
	}
	
	public static void main(String[] args) {
		SLType2 sl = new SLType2();
		for(int i=0;i<15;i++){
			sl.addNode(new Data(i+"",i+""));
		}
		System.out.println(sl.len);
		sl.print();
	}
}
  